package database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by Lxh on 2018/1/2.
 */

public class LivesqliteHelper extends SQLiteOpenHelper {
    private static final String dataBaseName = "qualitys.db";
    private static final int version = 1;

    private LivesqliteHelper(Context context, String name, SQLiteDatabase.CursorFactory cursorFactory, int version) {
        super(context, name, cursorFactory, version);
    }

    public LivesqliteHelper(Context context) {
        this(context, dataBaseName, null, version);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        String sql = "create table qualitys(" +
                "id integer primary key," +
                "pm integer," +
                "temp integer," +
                "co integer," +
                "light integer," +
                "humidity integer" +
                ")";
        sqLiteDatabase.execSQL(sql);
        Log.w("Lxh", "表创建成功");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
